<template>
  <div class='xtx-goods-page' >
    <div class="container" v-if="goodData.categories">
      <!-- 面包屑 -->
      <XtxBread>
        <XtxBreadItem to="/">首页</XtxBreadItem>
        <XtxBreadItem :to="`/category/${goodData.categories[1].id}`">{{goodData.categories[1].name}}</XtxBreadItem>
        <XtxBreadItem :to="`/subCategory/${goodData.categories[0].id}`">{{goodData.categories[0].name}}</XtxBreadItem>
        <XtxBreadItem >{{goodData.name}}</XtxBreadItem>
      </XtxBread>
      <!-- 商品信息 -->
      <div class="goods-info"></div>
      <!-- 商品详情 -->
      <div class="goods-footer">
        <div class="goods-article">
          <!-- 商品+评价 -->
          <div class="goods-tabs"></div>
        </div>
        <!-- 24热榜+专题推荐 -->
        <div class="goods-aside"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { findGoods } from '@/api/goods'
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
export default {
  name: 'XtxGoodsPage',
  setup () {
    const goodData = ref({})
    const route = useRoute()
    async function loadData () {
      const res = await findGoods(route.params.id)
      console.log(res)
      goodData.value = res.result
    }
    onMounted(() => {
      loadData()
    })
    return {
      goodData

    }
  }
}
</script>

<style scoped lang='less'>
.goods-info {
  min-height: 600px;
  background: #fff;
}
.goods-footer {
  display: flex;
  margin-top: 20px;
  .goods-article {
    width: 940px;
    margin-right: 20px;
  }
  .goods-aside {
    width: 280px;
    min-height: 1000px;
  }
}
.goods-tabs {
  min-height: 600px;
  background: #fff;
}
.goods-warn {
  min-height: 600px;
  background: #fff;
  margin-top: 20px;
}
</style>
